# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=kfilemetadata
pkgver=5.95.0
pkgrel=0
pkgdesc="A library for extracting file metadata"
arch="all !armhf" # armhf blocked by extra-cmake-modules
url="https://community.kde.org/Frameworks"
license="LGPL-2.1-or-later AND ( LGPL-2.1-only OR LGPL-3.0-only )"
depends_dev="qt5-qtbase-dev karchive-dev kcoreaddons-dev ki18n-dev kconfig-dev exiv2-dev taglib-dev attr-dev"
makedepends="$depends_dev extra-cmake-modules ffmpeg-dev qt5-qttools-dev doxygen samurai"
source="https://download.kde.org/stable/frameworks/${pkgver%.*}/kfilemetadata-$pkgver.tar.xz"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_QCH=ON
	cmake --build build
}

check() {
	cd build

	# Broken tests
	local skipped_tests="("
	local tests="
		usermetadatawritertest
		extractorcoveragetest
		propertyinfotest_localized
		extractorcollectiontest
		"
	for test in $tests; do
		skipped_tests="$skipped_tests|$test"
	done
	skipped_tests="$skipped_tests)test"
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest -E "$skipped_tests"
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install
}

sha512sums="
ceedf522546f9dca4de8e772a0ded8a11eeae2771a72690634fd36a3c68288af461fcf1ab901c3d54c2363f9d6b364e8139a71f030634aff3ae17794195f6e0c  kfilemetadata-5.95.0.tar.xz
"
